<?php

class NoseyModule extends CWebModule
{
    private $_assetsUrl;
    
    public $entity_model;
    public $after_submit_url;
    
    public function init()
    {
            // this method is called when the module is being created
            // you may place code here to customize the module or the application

            // import the module-level models and components
            $this->setImport(array(
                    'nosey.models.*',
            ));
        
        $this->configure(array(
            'preload'=>array('jsTrans'),
            'components'=>array(
                'jsTrans'=>array(
                    'class'=>'nosey.extensions.JsTrans.JsTrans',
                    'categories'=>'noseyModule.app', // the categories to be made available 
                    'languages'=>'es', // the languages to be made available
                    'onMissingTranslation'=>array('default/missingTranslation'), // optional route to handle untranslated messages
                )
            )
        ));
        $this->preloadComponents();
        new JsTrans('noseyModule.app','es');
    }
    
    public function getAssetsUrl()
    {
        if ($this->_assetsUrl === null)
            $this->_assetsUrl = Yii::app()->getAssetManager()->publish(
                Yii::getPathOfAlias('application.modules.nosey.assets')
            );
        return $this->_assetsUrl;
    }

    public function beforeControllerAction($controller, $action)
    {
        if(parent::beforeControllerAction($controller, $action))
        {
            return true;
        }
        else
            return false;
    }
}
